#include "bt_package/BtNode.h"
#include <plog/Log.h>
#include <plog/Logger.h>
#include <plog/Appenders/ColorConsoleAppender.h>  // 如果需要彩色输出
#include <plog/Formatters/TxtFormatter.h>          // 如果需要简单文本格式输出
#include <plog/Initializers/RollingFileInitializer.h> //初始化
#include <cstdio>

#define CONFIG_PATH "/opt/ft/robot_master/config/bt_node.json"

int main(int argc, char **argv) {
  rclcpp::init(argc, argv);

  // log init
  plog::init(plog::info, "/home/heming/robot_master/log/bt_node.log",
             104857600, 5); // 100M
  plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
  plog::get()->addAppender(
      &consoleAppender); // Also add logging to the console.

  auto ptr_bt_node = std::make_shared<BtNode>("bt_node", CONFIG_PATH);

  rclcpp::spin(ptr_bt_node);

  ptr_bt_node->joinExec_Thread();//

  rclcpp::shutdown();
  return 0;

}
